package main

import (
	"fmt"
	"gin_test/config"
	"gin_test/core"
	"gin_test/global"
	"gin_test/routers"
	"github.com/gin-gonic/gin"
)

func main() {
	// 初始化logger
	global.Log = core.InitLogger()

	// 初始化mysql
	core.InitMysql()

	// 初始化redis
	core.InitRedis()

	// gin框架启动
	gin.SetMode(config.Config.System.Env) // 设置启动模式
	router := gin.New()
	router.Use(gin.Recovery()) // 跌机时恢复
	routers.InitRouter(router) //初始化路由
	router.Run(fmt.Sprintf("%s:%d", config.Config.System.Host, config.Config.System.Port))
}
